import axios from "axios";
import { getToken } from "./token";
const request = axios.create({
  baseURL: "http://geek.itheima.net/v1_0",
  timeout: 5000,
});
request.interceptors.request.use((config) => {
  let token = getToken();
  if (token) {
    config.headers.Authorization = `Bearer ${token}`;
 
  }
  return config;
});
request.interceptors.response.use((result) => {
  return result.data;
});
export default request;
